package whu.cn.whushare.ui.main.known.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;

import whu.cn.whushare.R;
import whu.cn.whushare.ui.main.known.bean.Topic;

public class TopicAdapter extends BaseAdapter {
	private Context mContext;
	private List<Topic> mTopics;

	public TopicAdapter(Context mContext, List<Topic> list) {
		this.mContext = mContext;
		this.mTopics = list;
	}

	@Override
	public int getCount() {
		return mTopics.size();
	}

	@Override
	public Object getItem(int position) {
		return mTopics.get(position);
	}

	@Override
	public long getItemId(int position) {
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if (convertView == null) {
			convertView = LayoutInflater.from(mContext).inflate(R.layout.layout_topic_item, null);
		}
		((TextView) convertView).setText(mTopics.get(position).topicName);
		return convertView;
	}

}
